<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<body>
		<button><<</button>
		<button><</button>
		<button>></button>
		<button>>></button>
		<script type="text/javascript">
			var buts=document.getElementsByTagName("button");
			var arr1=["中国","美国","英国","法国","德国","日本","马来西亚"];
			var arr2=[];
			console.log("最开始的arr1数组为:"+arr1);
			console.log("最开始的arr2数组为:"+arr2);
			for(var i=0;i<buts.length;i++){
				buts[i].onclick=function(){
					if(this.innerText==">>"){
						arr2=arr2.concat(arr1);
						arr1=[];
						console.log("新的arr1数组为:"+arr1);
						console.log("新的arr2数组为:"+arr2);
					}else if(this.innerText=="<<"){
						arr1=arr1.concat(arr2);
						arr2=[];
						console.log("新的arr1数组为:"+arr1);
						console.log("新的arr2数组为:"+arr2);
					}else if(this.innerText==">"){
						var dels=arr1.splice(0,1);
						arr2=arr2.concat(dels);
						console.log("新的arr1数组为:"+arr1);
						console.log("新的arr2数组为:"+arr2);
					}else if(this.innerText=="<"){
						var dels=arr2.splice(0,1);
						arr1=arr1.concat(dels);
						console.log("新的arr1数组为:"+arr1);
						console.log("新的arr2数组为:"+arr2);
					}
				}
			}
			
		</script>
	</body>
</html>
